home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-03-12 | 2.0 KB | 105 lines | [TEXT/CWIE] |
- /*
- ********************************************************************************
- **
- ** File: GSpTest_Init.cp
- **
- ** Description:
- **
- ** Initialization and termination routines.
- **
- ********************************************************************************
- */
- #include "DrawSprocket.h"
-
- #include "GSpTest_Main.h"
- #include "GSpTest_Init.h"
- #include "GSpTest_AEvt.h"
- #include "GSpTest_EventLoop.h"
- #include "GSpTest_DSpSupport.h"
-
- #include "GoggleSprocket.h"
-
- /*
- ********************************************************************************
- **
- ** Name: Initialize
- **
- ** Description:
- **
- ** Toolbox initialization.
- **
- ********************************************************************************
- */
- OSErr // result code
- Initialize( void )
- {
- OSErr theError;
- Handle theMenuBar;
-
- // init Mac toolbox
- InitGraf( &qd.thePort );
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(nil);
- InitCursor();
- FlushEvents( everyEvent, 0 );
- theError = AEStartup();
- if( theError )
- return kError_AppleEvents;
-
- // setup menus
- theMenuBar = GetNewMBar( kMBAR_ID );
- if( NULL == theMenuBar )
- return kError_ResNotFound;
- SetMenuBar( theMenuBar );
- DisposeHandle( theMenuBar );
- AppendResMenu( GetMenuHandle( kMenu_Apple ), 'DRVR');
- DrawMenuBar();
-
- // init and put the display into paused mode
- theError = DisplayInit();
- if( theError )
- return theError;
- DisplayFadeOut();
- theError = DisplayPause();
- DisplayFadeIn();
- if( theError )
- return theError;
-
- // startup goggle sprocket
- theError = GSpStartup( NULL );
- if( theError )
- return theError;
-
- // set the arrow cursor
- SetCursor( &qd.arrow );
-
- // done
- return theError;
- }
-
- /*
- ********************************************************************************
- **
- ** Name: Terminate()
- **
- ** Description:
- **
- ** Cleanup and terminate.
- **
- ********************************************************************************
- */
- void Terminate( void )
- {
- GSpShutdown( NULL );
-
- // DisplayRelease() will fade out/in
- DisplayRelease();
-
- AEShutdown();
-
- ExitToShell();
- }
-